import { RenderStateStack } from "./RenderState";
import { TestApp } from "./TestApp";

function ch4(){
    let canvas = document.getElementById("canvas") as HTMLCanvasElement
    let app = new TestApp(canvas);

    let startButton = document.getElementById("start") as HTMLButtonElement;

    startButton.onclick = () => {
        app.start()
    }
    let stopButton = document.getElementById("stop") as HTMLButtonElement;

    stopButton.onclick = () => {
        app.stop();
    }

    // let url = "./data/test.jpg";
    // app.loadAndDrawImage(url);

    // app.drawColorCanvas();
}

function ch4State(){
    // 声明一个渲染状态机
    let stack = new RenderStateStack();
    stack.printCurrentStateInfo();
    
    stack.save();
    
    stack.lineWidth = 10
    stack.fillStyle = "black";

    stack.printCurrentStateInfo();

    stack.restore();
    stack.printCurrentStateInfo();
}


export {
    ch4,
    ch4State
}